#include <bits/stdc++.h>
using namespace std;

#define x first
#define y second

typedef pair<int, int> PII;
typedef pair<pair<int, int>, int> PIII;

const int N = 100005;

int n, m, m1, m2;
PII t1[N], t2[N];
PIII at1[2 * N], at2[2 * N];
bool st1[N], st2[N];

int eval(int num)
{
	int num1 = 0, num2 = 0;
	int res1 = 0, res2 = 0;
	
	if (num < 0 || num > n)
		return -0x3f3f3f3f;
		
	for (int i = 0; i < 2 * m1; i++)
	{
		if (at1[i].x.y == 1 && num1 < num)
		{
			num1++;
			res1++;
			st1[at1[i].y] = true;
		}
		else if (at1[i].x.y == -1 && st1[at1[i].y])
		{
			num1--;
			st1[at1[i].y] = false;
		}	
	}
	
	num = n - num;
	
	for (int i = 0; i < 2 * m2; i++)
	{
		if (at2[i].x.y == 1 && num2 < num)
		{
			num2++;
			res2++;
			st2[at2[i].y] = true;
		}
		else if (at2[i].x.y == -1 && st2[at2[i].y])
		{
			num2--;
			st2[at2[i].y] = false;
		}
	}
	
	return res1 + res2;
}

int main()
{
	freopen("airport.in", "r", stdin);
	freopen("airport.out", "w", stdout);
	
	scanf("%d%d%d", &n, &m1, &m2);
	
	m = m1 + m2;
	
	for (int i = 0; i < m1; i++)
	{
		scanf("%d%d", &t1[i].x, &t1[i].y);
		
		at1[2 * i].x.x = t1[i].x;
		at1[2 * i + 1].x.x = t1[i].y;
		at1[2 * i].x.y = 1;
		at1[2 * i + 1].x.y = -1;
		at1[2 * i].y = i;
		at1[2 * i + 1].y = i;
	}
		
	for (int i = 0; i < m2; i++)
	{
		scanf("%d%d", &t2[i].x, &t2[i].y);
		
		at2[2 * i].x.x = t2[i].x;
		at2[2 * i + 1].x.x = t2[i].y;
		at2[2 * i].x.y = 1;
		at2[2 * i + 1].x.y = -1;
		at2[2 * i].y = i;
		at2[2 * i + 1].y = i;
	}
	
	sort(t1, t1 + m1);
	sort(t2, t2 + m2);
	sort(at1, at1 + 2 * m1);
	sort(at2, at2 + 2 * m2);
	
	int res = 0;
	for (int i = 0; i <= n; i++)
		res = max(res, eval(i));
		
	printf("%d", res);
}
